# -*- coding: utf-8 -*-
import pandas as pd
from django.http import JsonResponse


def ex(data,can):
    r = [{'value': v, 'name': k} for v, k in zip(data[can], [can for i in range(len(data[can]))])]
    return r
def cul(request):
    # -*- coding: utf-8 -*-
    data = pd.read_excel('D:/study/ana_envs/djangoProject/db/data.xlsx', names= ['title', 'url', 'date', 'describe'])
    data = data.fillna('加载失败')
    print(data)
    return JsonResponse({'title':ex(data,'title'),'url':ex(data,'url'),'date':ex(data,'date'),'describe':ex(data,'describe')})
